bitkeeper revision 1.1108.35.5 (41090ef2VknMjEjPGflC7vkB7aE0IQ)
authormjw@wray-m-3.hpl.hp.com <mjw@wray-m-3.hpl.hp.com>
Thu, 29 Jul 2004 14:51:30 +0000 (14:51 +0000)
committermjw@wray-m-3.hpl.hp.com <mjw@wray-m-3.hpl.hp.com>
Thu, 29 Jul 2004 14:51:30 +0000 (14:51 +0000)
Add commands to convert between domain names and ids.

tools/python/xen/xm/main.py

index 94fc53a1f9b80ce5c61f8deadf5c8f1ca06230ce..e1ff33ed87bee87caa39cf3422a7a60ddb2baf4a 100644 (file)
@@ -452,6 +452,40 @@ class ProgMaxmem(Prog):
 
 xm.prog(ProgMaxmem)
 
+class ProgDomid(Prog):
+    group = 'domain'
+    name = 'domid'
+    info = 'Convert a domain name to a domain id.'
+
+    def help(self, args):
+        print args[0], "DOM"
+        print '\nGet the domain id for the domain with name DOM.'
+        
+    def main (self, args):
+        if len(args) != 2: self.err("%s: Invalid argument(s)" % args[0])
+        name = args[1]
+        dom = server.xend_domain(name)
+        print sxp.child_value(dom, 'id')
+
+xm.prog(ProgDomid)
+
+class ProgDomname(Prog):
+    group = 'domain'
+    name = 'domname'
+    info = 'Convert a domain id to a domain name.'
+
+    def help(self, args):
+        print args[0], "DOM"
+        print '\nGet the name for the domain with id DOM.'
+        
+    def main (self, args):
+        if len(args) != 2: self.err("%s: Invalid argument(s)" % args[0])
+        name = args[1]
+        dom = server.xend_domain(name)
+        print sxp.child_value(dom, 'name')
+
+xm.prog(ProgDomname)
+
 class ProgBvt(Prog):
     group = 'scheduler'
     name = "bvt"